<template>
	<view class="app-container">
		<!-- 标题 -->
		<view class="title">{{policy.title}}</view>
		<!-- 文本内容 -->
		<view class="text" v-if="policy.textContent" v-html="policy.textContent"></view>
		<!-- 附件 -->
		<view class="file" v-if="policy.fileUrl">
			<text>附件：{{policy.fileName}}</text>
			<text class="text-link" @click="download()">点击下载</text>
		</view>
	</view>

</template>

<script>
	import { ApiPolicy } from "@/api/information/index.js";
	import FileUtil from "@/util/FileUtil.js"
	
	export default {
		data() {
			return {
				policy: {},
			}
		},
		created() {
			
		},
		onLoad(option) {
			this.getInfo(option.id);
		},
		methods: {
			/**
			 * 查询轮播图
			 */
			getInfo(id) {
				ApiPolicy.getInfo(id).then(res=>{
					this.policy = res.data;
				})
			},
			
			download(){
				FileUtil.preview(this.policy.fileUrl, 'file');
			},
		}
	}
</script>

<style lang="scss">
	.app-container {
		padding: 0 30upx;
		box-sizing: border-box;
	}
	
	.title{
		width: 100%;
		text-align: center;
		padding-top: 40upx;
		padding-bottom:30upx;
		font-size: 16px;
		font-weight: bold;
	}
	.text{
		width: 100%;
		padding: 30upx;
		box-sizing: border-box;
		font-size: 14px;
		line-height: 24px;
	}
</style>
